using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using NTTHAO.Common.BL;

public partial class admin_webparts_Plug_inForwarder_PlugInForwarder : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string pluginName = Request.QueryString["name"];
            string controlName = null;

            if (pluginName != null)
            {
                pluginName = pluginName.Trim();
                if (pluginName.Equals("common", StringComparison.OrdinalIgnoreCase))
                {
                    controlName = "../Plug-ins/CommonPage/CommonPageManagement.ascx";
                }
                else
                {
                    Plugin plugin = new Plugin(pluginName);

                    if (plugin.ID > 0)
                    {
                        controlName = "../Plug-ins/" + plugin.AdminManagerURL;
                    }
                    else
                    {
                        controlName = "PlugInList.ascx";
                    }
                }
            }
            else
            {
                controlName = "PlugInList.ascx";
            }

            if (controlName != null)
            {
                Control ctrl = LoadControl(controlName);
                this.Controls.Add(ctrl);
            }
        }
        catch (Exception ex)
        {
            HtmlGenericControl ctrl = new HtmlGenericControl("div");
            ctrl.InnerHtml = "<p>" + ex.Message + "</p><p>" + ex.StackTrace + "</p>";
            this.Controls.Add(ctrl);
        }
    }
}
